﻿using EYCmsAdmin.Domain.Models;
using FluentNHibernate.Mapping;

namespace EYCmsAdmin.NHibernate.Mappings
{
    public class EducationInstitutionMap : ClassMap<EducationInstitution>
    {
        public EducationInstitutionMap()
        {
            Id(x => x.Id).GeneratedBy.Identity().Not.Nullable();
            Map(x => x.City).Length(50).Not.Nullable();
            Map(x => x.Director).Length(50).Not.Nullable();
            Map(x => x.Email).Length(50).Not.Nullable();
            Map(x => x.Phone).Length(50).Not.Nullable();
            Map(x => x.Name).Length(50).Not.Nullable();
            Map(x => x.Region).Length(50).Not.Nullable();
            Map(x => x.WebSite).Length(50).Not.Nullable();
            HasMany(x => x.StudyGroups).KeyColumn("EducationInstitutionId").Cascade.None().Inverse();
        }
    }
}